import request from '@/utils/request'
import processRichText from "@/utils/processRichText"
import {
	ref,
} from 'vue'

export default () => {
	const activities = ref([])
	const activity = ref({
		title: "",
		post: "",
		Groupcourse: {
			intensity: 0,
			color: "",
			course_type: {
				name: ""
			}
		},
		introduce: "",
		price: 0,
		start_time: "",

	})
	const getActivities = async () => {
		activities.value = await request.get(`mini/activity/list`)
	}
	const showActivity = async (id) => {
		let data = await request.get(`mini/activity/${id}/one`)
		data.introduce = processRichText(data.introduce)
		activity.value = data
	}
	return {
		activities,
		getActivities,
		showActivity,
		activity
	}
}